import axios from './axios';

/**
 * 登录
 * @param {*}} url 
 * @param {*} data 
 */
export const login = async (data) => {
    return await axios.post('user/signin', data)
}


/**
 * 注册
 * @param {*} url 
 * @param {*} data 
 */
export const register = async (data) => {
    return await axios.post('user/signup', data)
}

/**
 * 退出登录
 * @param {*} data 
 */
export const logout = async () => {
    return await axios.post('user/signout');
}

export const refresh = async (data) => {
    return await axios.post('user/refresh', data);
}


/**
 * 搜索文章
 * @param {*} q 
 */
export const searchFromArticle = (q) => {
    return axios.get('/article/articleSearch', { params: { q } })
}


/**
 * 搜索用户
 * @param {*} q 
 */
export const searchFromUser = (q) => {
    return axios.get('/user/userSearch', { params: { q } })
}

/**
 * 综合
 * @param {*} q 
 */
export const searchFromAll = (q) => {
    return axios.get('/article/getAll', { params: { q } })
}

